<html class="hb-loaded">
 <head> 
  <meta content="text/html;charset=utf-8" http-equiv="Content-Type" /> 
  <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" /> 
  <meta content="yes" name="apple-mobile-web-app-capable" /> 
  <meta content="black" name="apple-mobile-web-app-status-bar-style" /> 
  <meta content="telephone=no" name="format-detection" /> 
  <meta content="email=no" name="format-detection" /> 
  <title>个人中心 - 订单详情</title> 
 
  <script src="js/jquery.min.js"></script> 
  <script src="js/bootstrap.min.js"></script> 
  <link rel="stylesheet" href="css/bootstrap.min.css" /> 
  <link rel="stylesheet" href="css/public.v20150930.css" /> 
  <script src="js/ygop.ajax.client.js"></script> 
  <script src="js/Common.v150812.js"></script> 
  <script src="js/layer.m.js"></script> 
  <link rel="stylesheet" href="css/layer.css" /> 
  <script src="js/jweixin-1.0.0.js" type="text/javascript"></script> 
  <link rel="stylesheet" href="css/gps.css" /> 




 </head> 
 <body> 
  <link rel="stylesheet" href="css/order.css" /> 
  <div class="wrap"> 
   <div class="order"> 
    <dl class="order-base"> 
     <dt>
      基本信息
     </dt> 
     <dd> 
      <div> 
       <ul> 
        <li>订单编号：<span id="spOrderNo">11739268</span></li> 
        <li>订单状态：<span class="track" id="spOrderStateName">等待支付</span></li> 
        <li>订单金额：<span id="spOrderAmount">￥124.00</span></li> 
        <li>运费：<span id="spDeAmount">￥0.00</span></li> 
        <li>配送日期：<span id="spOrderDate">2015-10-26</span></li> 
       </ul> 
      </div> 
      <div style="" id="btnGoPay" class="btn">
       <a>去支付</a>
      </div> 
     </dd> 
    </dl> 
    <dl> 
     <dt>
      收货地址
     </dt> 
     <dd class="address"> 
      <div>
       <span class="name"><span class="icon"></span><font id="ftUserName">黄金林</font></span>
       <span class="tel"><span class="icon"></span><font id="ftMobile">18005151538</font></span>
      </div> 
      <div id="divAddress">
       上海宝山区场景楼13号107
      </div> 
     </dd> 
    </dl> 
    <dl> 
     <dt>
      发票信息
     </dt> 
     <dd>
      <div id="divFp">
       不需要发票
      </div>
     </dd> 
    </dl> 
    <dl> 
     <dt>
      商品列表
     </dt> 
     <dd class="goods_list"> 
      <div class="list-item">
       <a href="/product/196068.html"><span><img width="50" height="50" src="images/441634252490579786.jpg" /></span><span>美国加州(整条）鱿鱼1kg <br /> &times;1</span><span class="green">￥58.00</span></a>
      </div> 
      <div class="list-item">
       <a href="/product/156159.html"><span><img width="50" height="50" src="images/441634252785164106.jpg" /></span><span>阿拉斯加格陵兰大比目鱼(切段) <br /> &times;1</span><span class="green">￥66.00</span></a>
      </div>
     </dd> 
    </dl> 
    <dl> 
     <dt>
      支付方式
     </dt> 
     <dd id="ddPayments">
      <div>
       支付宝&nbsp;&nbsp;￥124.00
      </div>
     </dd> 
    </dl> 
    <dl style="" id="btnCancelOrder"> 
     <dd class="cancel_order">
      <a>取消订单</a>
     </dd> 
    </dl> 
   </div> 
  </div> 
  <script type="text/javascript">
    var orderId = "5dfa3cac-899d-46ac-89af-bc8c73238ed3";
    var passKey = "48b16bede5c7f1c61cf9f42c10d00f4d";
    $(function () {
        $(".footer a").removeClass();
        $(".footer #my").addClass("current");
        //加载订单详情
        getOrder();
        bindOperate();
    })

    //获取订单详情
    function getOrder() {
        var data = {};
        data.OrderId = orderId;
        YgmJsCommon.popups.loading();
        ygopAjaxClient.async("/OrderOpt/GetOrderInfo", "post", data, function (e) {
            YgmJsCommon.popups.close();
            var rspcode = e.RspCode;
            if (rspcode != 0) {
                var html = "";
                var data = e.RspData.data;
                var orderStateName = e.RspData.OrderStateName;
                if (data != undefined && data != null && data != "") {
                    //显示操作按钮
                    displayOperate(data.WaitForOnlinePay, data.CanCancel);

                    //基本信息
                    $("#spOrderNo").html(data.SerialNumber);
                    $("#spOrderStateName").html(orderStateName);
                    $("#spOrderAmount").html("￥" + parseFloat(data.TotalPrice).toFixed(2));
                    $("#spDeAmount").html("￥" + parseFloat(data.Freight).toFixed(2));
                    $("#spOrderDate").html(data.DeliveryDate.substring(0, 10));

                    //收货地址
                    $("#ftUserName").html(data.Consignee);
                    $("#ftMobile").html(data.ConsigneeMobile);
                    $("#divAddress").html(data.ConsigneeInfo.ProvinceName + data.ConsigneeInfo.AreaName + data.ConsigneeInfo.ConsigneeAddress);

                    //发票信息
                    if (data.Invoice) {
                        if (data.Invoice.InvoiceTitle != null)
                            $("#divFp").html("发票抬头:" + data.Invoice.InvoiceTitle + "<br/>发票内容:" + data.Invoice.InvoiceContent + "<br/>寄送方式:" + data.Invoice.DeliveryText);
                    }

                    //商品列表
                    var htmlProduct = "";
                    var productList = data.Commoditys;
                    if (productList) {
                        for (var i = 0; i < productList.length; i++) {
                            htmlProduct += ' <div class="list-item">';
                            htmlProduct += '<a href="/product/' + productList[i].CommodityCode + '.html">';
                            htmlProduct += '<span><img width="50" height="50" src="' + productList[i].SmallPic + '"></span>';
                            htmlProduct += '<span>' + productList[i].CommodityName + ' <br> ×' + productList[i].CommodityAmount + '</span>';
                            htmlProduct += '<span class="green">￥' + parseFloat(productList[i].CommodityPrice).toFixed(2) + '</span>';
                            htmlProduct += '</a>';
                            htmlProduct += '</div>';
                        }
                        $(".goods_list").html(htmlProduct);
                    }

                    //支付方式
                    var htmlPay = "";
                    var payments = data.Payments;
                    for (var i = 0; i < payments.length; i++) {
                        htmlPay += "<div>" + payments[i].PaymentName + "&nbsp;&nbsp;" + "￥" + parseFloat(payments[i].PaymentPrice).toFixed(2) + "</div>";
                    }
                    $("#ddPayments").html(htmlPay);
                }
            }
            else {
                YgmJsCommon.popups.alert(e.RspMsg);
            }
        });
    }


    //显示等待支付和取消订单
    function displayOperate(waitForOnlinePay, canCancel) {
        if (waitForOnlinePay == true) {
            $("#btnGoPay").css("display", "");
        }
        if (canCancel == true) {
            $("#btnCancelOrder").css("display", "");
        }
    }

    //绑定去支付和取消订单操作
    function bindOperate() {
        //去支付操作
        $("#btnGoPay").click(function () {
            //alert("去支付" + orderId);
            window.location.href = "/gotopay/" + orderId + "?passKey=" + passKey;
        })
        //取消订单操作
        $("#btnCancelOrder").click(function () {
            YgmJsCommon.popups.confirm("您确定要取消订单吗？", function () {
                cancelOrder();
            })
        })
    }


    //取消订单
    function cancelOrder() {
        var data = {};
        data.OrderId = orderId;
        ygopAjaxClient.async("/OrderOpt/CancelOrder", "post", data, function (e) {
            var rspcode = e.RspCode;
            if (rspcode == 1) {
                // 取消订单
                dplus.track("取消订单");
                YgmJsCommon.popups.alert(e.RspMsg, function () { window.location.href = "member_order.html"; });
            }
            else {
                YgmJsCommon.popups.alert(e.RspMsg);
            }
        });
    }
</script> 
  <footer class="footer"> 
   <a class="" href="index.html" id="index"><span class="home">首页</span>首页</a> 
   <a href="cat.html" id="category"><span class="catalog">分类</span>分类</a> 
   <a href="cart.html" id="cart"> <span class="shopping">购物车<font id="fCartProductTotalCount" class="badge" style="display: none;"></font></span>购物车 </a> 
   <a href="member_index.html" id="my" class="current"><span class="my">我的易果</span>我的易果</a> 
  </footer> 
  <div data-backdrop="static" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="divMyCity" class="modal" style="display: none;"> 
   <div role="document" class="modal-dialog"> 
    <div id="divCityContent" class="modal-content"> 
     <div style=" display:block;" class="gpstips"> 
      <a> <em class=" icon icon_gps"> </em> 亲，请先选择您的收货城市 <em class=" icon icon_arrowright"> </em> </a> 
     </div> 
    </div> 
   </div> 
  </div> 
  <script type="text/javascript">
        var _wx_JsConfig = {};
        _wx_JsConfig.appid = "wx0d4f4f0e0bada80e";
        _wx_JsConfig.imgUrl = "http://img02.yiguo.com/e/web/150930/00783/155744/wxlogo.jpg";
        _wx_JsConfig.title = "易果生鲜触屏版";
        _wx_JsConfig.content = "全国首家生鲜专业电商，全球优质生鲜产地直供，全年无休生鲜冷链配送";
        _wx_JsConfig.timeLineLink = "http://weixin.m.yiguo.com";

        _wx_JsConfig.timestamp = "";
        _wx_JsConfig.nonceStr = "";
        _wx_JsConfig.signature = "";

        $(function () {
            YgmJsCommon.domain = "yiguo.com";
            var jsonWxCfg = decodeURIComponent("%7b%22appId%22%3anull%2c%22timestamp%22%3a%221445765784%22%2c%22nonceStr%22%3a%221309023938%22%2c%22signature%22%3a%22dfb2b5ed158db4872b99fc71e70651b42c439d70%22%2c%22url%22%3a%22http%3a%2f%2fweixin.m.yiguo.com%2forder%2f5dfa3cac-899d-46ac-89af-bc8c73238ed3%3fpasskey%3d48b16bede5c7f1c61cf9f42c10d00f4d%22%2c%22jsapi_ticket%22%3a%22bxLdikRXVbTPdHSM05e5u_n3yqdZ_9Pt0dvnbtzvrXZ2Bps91PjRajJdScVYkXWafhoi6zfSwxWok0rXn11cmQ%22%7d");
            var wxJsCfg = JSON.parse(jsonWxCfg);
            _wx_JsConfig.timestamp = wxJsCfg.timestamp;
            _wx_JsConfig.nonceStr = wxJsCfg.nonceStr;
            _wx_JsConfig.signature = wxJsCfg.signature;

            wx.config({
                //debug: true,
                appId: _wx_JsConfig.appid,
                timestamp: _wx_JsConfig.timestamp,
                nonceStr: _wx_JsConfig.nonceStr,
                signature: _wx_JsConfig.signature,
                jsApiList: [
                    'onMenuShareTimeline',
                    'onMenuShareAppMessage'
                ]
            });

            myShare();

            getCartCount();

            showSelectedCityDialog();
        })

        function myShare() {
            wx.ready(function () {
                //分享朋友圈
                wx.onMenuShareTimeline({
                    title: _wx_JsConfig.title,
                    desc: _wx_JsConfig.content, // 分享描述
                    link: _wx_JsConfig.timeLineLink,
                    imgUrl: _wx_JsConfig.imgUrl,
                    trigger: function (res) {
                    },
                    success: function (res) {
                        dplus.track("分享到朋友圈");
                    },
                    cancel: function (res) {
                    },
                    fail: function (res) {
                    }
                });
                //分享朋友
                wx.onMenuShareAppMessage({
                    title: _wx_JsConfig.title,
                    desc: _wx_JsConfig.content,
                    link: _wx_JsConfig.timeLineLink,
                    imgUrl: _wx_JsConfig.imgUrl,
                    trigger: function (res) {
                    },
                    success: function (res) {
                        dplus.track("分享给朋友");
                    },
                    cancel: function (res) {
                    },
                    fail: function (res) {
                    }
                });
            });

        }

        //如果查询到CityCookie default=1，表示用户没有选择过城市，则需要弹出选择城市
        function showSelectedCityDialog() {
            var objCity = YgmJsCommon.getCityCookie();
            if (objCity != null && objCity.Default == 1) {
                $("#divMyCity").css('display', "");
                $("#divMyCity").modal('show');
                $("#divMyCity").click(function () {
                    window.location.href = "/Home/SelectCity";
                })
            }
            else {
                $("#divMyCity").css('display', "none");
            }
        }

        //返回商品数量显示在footer上
        function getCartCount() {
            var count = YgmJsCommon.getCartProductsTotalCount();
            if (count > 0) {
                $("#fCartProductTotalCount").css("display", "");
                $("#fCartProductTotalCount").html(count);
            }
            else {
                $("#fCartProductTotalCount").css("display", "none");
            }
            return count;
        }

        //设置云朵的位置
        $('#divMyCity').on('shown.bs.modal', function () {
            var win_width = $(this).find(".modal-dialog").width();
            var win_height = $(this).find(".modal-dialog").height();
            $(this).find(".modal-dialog").css({ "marginTop": String(-1 * win_height / 2) + "px", "marginLeft": String(-1 * win_width / 2) + "px" });

        });

        window.onload = function () {
            
        };
    </script> 
 </body>
</html>